//绘制海葵
var aneObj=function(){
	//start   point,control  point  ,end  point(sin)
	
	this.rootx=[];//起始点的x坐标，y坐标是已知的，就是画布的高度
	this.headx=[];
	this.heady=[];
//	this.len=[];
    this.alpha=0;
    this.amp=[];//海葵的振幅
}
aneObj.prototype.num=50;
aneObj.prototype.init=function(){
	
	for (var i=0;i<this.num;i++) {
		
		this.rootx[i]=i*20+Math.random()*20;//海葵的间隔
		this.headx[i]=this.rootx[i];
		this.heady[i]=canHeight-200+Math.random()*50;
//		this.len[i]=200+Math.random()*50;//海葵的高度
        this.amp[i]=Math.random()*50+40;
	}

}
aneObj.prototype.draw=function(){
	
	this.alpha+=deltaTime*0.0006;
	var l=Math.sin(this.alpha);
	ctx2.save();
	ctx2.globalAlpha=0.5;//不透明度
	ctx2.lineWidth=20;
	ctx2.lineCap='round';
	ctx2.strokeStyle='#33cc99';
	//绘制
	for (var i=0;i<this.num;i++) {
		//beginPath,moveTo,lineTo,stroke,strokeStyle,lineWidth,linCap.globalAlpha
		ctx2.beginPath();
		ctx2.moveTo(this.rootx[i],canHeight);
		this.headx[i]=this.rootx[i]+l*this.amp[i];
		ctx2.quadraticCurveTo(this.rootx[i],canHeight-100,this.headx[i],this.heady[i]);
		ctx2.stroke();
	}
	ctx2.restore();
	//ctx2.save();与ctx2.restore();这一对API的意思就是说在一对之间的样式只在这一段起作用
	
}
